/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ua.org.pslava.codingtest.model;

/**
 * Encapsulates a functionality of BasketItem. <br/>
 *
 * 
 * @author Vyacheslav Panasyuk.
 */
public class BasketItem implements IBasketItem {

    private Product product;
    private Integer count;

    public BasketItem(Product product) {
        this.product = product;
        this.count = 1;
    }

    public String getProductName() {
        return product.getName();
    }

    public void add() {
        this.count++;
    }

    public void delete() {
        this.count--;
    }

    public Integer getCount() {
        return this.count;
    }

    public Double calculate() {
        return product.calculate(count);
    }
}
